package com.nobuyme.box.toy;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.nobuyme.box.R;
import com.nobuyme.box.util.FragmentUtils;
import com.pachong.android.baseuicomponent.activity.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.OnClick;

public class ShareDetailActivity extends BaseActivity {
    public static final String CONTENT = "content";
    public static final String IMGLIST = "image_list";
    String content;
    ArrayList<String> image_list;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        content = getIntent().getStringExtra(CONTENT);
        image_list = getIntent().getStringArrayListExtra(IMGLIST);
        ShareDetailFragment fragment = new ShareDetailFragment();
        Bundle bundle = new Bundle();
        bundle.putStringArrayList(IMGLIST,image_list);
        bundle.putString(CONTENT,content);
        fragment.setArguments(bundle);
        FragmentUtils.replaceFragment(getSupportFragmentManager(), R.id.fl_share_detail, fragment);

        hideToolbar();
    }

    public static void start(String content, ArrayList<String> image_list, Activity activity) {
        Intent intent = new Intent(activity, ShareDetailActivity.class);
        intent.putExtra(CONTENT,content);
        intent.putStringArrayListExtra(IMGLIST,image_list);
        activity.startActivity(intent);
    }

    @Override
    public View createDataView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View inflate = inflater.inflate(R.layout.activity_share_detail, null);
        return inflate;
    }

    @OnClick(R.id.btn_share_back)
    public void onViewClicked() {
        finish();
    }
}
